<template>
<div class="public-common">
    <!--车辆分配驾驶员-->
    <div class="public-title">车辆分配驾驶员列表</div>
    <div class="public-searchbox">
        <el-row>
            <el-col :span="6">
                <el-input placeholder="请输入内容" size="mini" v-model="form.test" class="input-with-select"/>
            </el-col>
            <el-col :span="18">
                <el-button type="primary" icon="el-icon-search" size="mini"  style="margin-left:10px;">搜索</el-button>
                <el-button type="success" icon="el-icon-edit-outline" size="mini" >新建</el-button>
                <el-button type="danger" icon="el-icon-delete" size="mini" >删除</el-button>
                <el-button type="warning" icon="el-icon-download" size="mini" >导出Excel</el-button>
            </el-col>
        </el-row>
    </div>
    <el-scrollbar class="public-scroll">
        <el-table :data="tabledata" size="mini" border stripe header-row-class-name="textcenter">
            <el-table-column
            type="selection"
            width="55" fixed="left">
            </el-table-column>
            <el-table-column
                label="车牌号">
                <template slot-scope="scope">
                    {{scope.row.carId}}
                </template>
            </el-table-column>                
            <el-table-column
                label="驾驶员">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="资格证号">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="服务监督卡类型">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="入职时间">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="离职时间">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="是否注销">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="备注">
                <template slot-scope="scope">
                    {{scope.row.carType}}
                </template>
            </el-table-column>
            <el-table-column
                label="操作" fixed="right">
                <template slot-scope="scope">
                    <el-button type="primary" size="mini">编辑</el-button>
                </template>
            </el-table-column> 
            
        </el-table>
    </el-scrollbar>
    <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.now"
        :page-sizes="page.sizes"
        :page-size="page.pagesize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total" style="margin-top:10px;">
    </el-pagination>

    <!--dialog-->
    <el-dialog title="车辆分配驾驶员" :visible.sync="dialog.isVisible" width="40%" top="8vh">
        <div style="padding:0 20px;">
            <el-form label-width="120px" size="mini">
                <el-form-item label="车牌号">
                    <el-select v-model="dialog.carid" placeholder="请选择" style="width:100%;">
                        <el-option
                        v-for="item in select.carids"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="驾驶员">
                    <el-select v-model="dialog.driver" placeholder="请选择" style="width:100%;">
                        <el-option
                        v-for="item in select.drivers"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="入职时间">
                    <el-date-picker
                    v-model="dialog.test"
                    type="date"
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                    placeholder="选择日期" style="width:100%;">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="离职时间">
                    <el-date-picker
                        v-model="dialog.test"
                        type="date"
                        format="yyyy-MM-dd"
                        value-format="yyyy-MM-dd"
                        placeholder="选择日期" style="width:100%;">
                        </el-date-picker>
                </el-form-item>
                <el-form-item label="服务监督卡类型">
                    <el-select v-model="dialog.cardtype" placeholder="请选择" style="width:100%;">
                        <el-option
                        v-for="item in select.cardtypes"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-model="dialog.mark"></el-input>
                </el-form-item>
            </el-form>
            <div class="public-tipsbox">
                <div class="tipsbox-tit">分配说明</div>
                <p>1. 1辆车最多分配3个不同的驾驶员，其中只能分配1个顶班驾驶员；</p>
                <p>2. 1个驾驶员只能分配到1辆车；</p>
                <p>3. 1个顶班驾驶员同时最多可分配到5辆不同的车。</p>
            </div>
            <div class="textcenter" style="margin-top:10px;">
                <el-button type="primary"  size="small">确定</el-button>  
                <el-button type="info" @click="dialog.isVisible = false"  size="small">返回</el-button>
            </div>
        </div>
        
    </el-dialog>
</div>
</template>
<script>
export default {
    data(){
        return {
            form:{
                test:''
            },
            tabledata:[],
            page:{
              now:1,
              pagesize:10,
              sizes:[2,10, 20, 50, 100],
              total:0,
              key:''
            },
            select:{
                carids:[],
                drivers:[],
                cardtypes:[]
            },
            dialog:{
                isVisible:false,
                carid:'',
                driver:'',
                cardtype:'',
                mark:''
            }
        }
    },
    mounted(){
        
    },
    methods:{
        search(){
            alert("search")
        },
        //分页
        handleSizeChange(pagesize){
            this.page.pagesize = pagesize;
            this.search(true,true);
        },
        handleCurrentChange(pageno){
            this.page.now = pageno;
            this.search(true,true);
        }

    }
}
</script>